<?php
class activitiesController extends Controller
{
    function showIndex()
    {
        $pagination_sql = "select * from activity order by startDate asc";
        $pagination_count_sql = "select count(1) as count from activity  order by startDate asc";
        $this->putIntoPage("pagination", $this->modules->Activity->pagination($pagination_sql, $pagination_count_sql));
        //   $this->putIntoPage("week", $this->modules->Activity->findThisWeek());
        $this->render("ActivitiesList");
    }


    function add()
    {
        return $this->render("ActivityAdd");
    }

    function edit()
    {
        $this->putIntoPage("activity", $this->modules->Activity->load($this->_get['id']));
        $this->render("ActivityAdd");
    }

    function save()
    {
        $this->putIntoPage("isSuccess", $this->checkIdFromPost("activityId")
                                              ? $this->modules->Activity->update($this->_post)
                                              : $this->modules->Activity->insert($this->_post));
        return $this->render("ActivityAdd");
    }

    function del()
    {
        $this->modules->Activity->delete($this->_get['id']);
        $this->showIndex();
    }
}

?>